#include <unistd.h>
#include <wait.h>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
char *envInit[] = {"USER=unknow", "PATH=/tmp", NULL};

int main(){
    pid_t pid;
    
    if((pid = fork()) < 0){
        printf("fork error.\n");
        exit(0);
    }else if(pid == 0){
        if(execle("/bin/ls", "echoall", "myarg1", "MY ARG2", NULL, envInit) < 0){
            printf("execle error.\n");
            exit(0);
        }
    }

    if(waitpid(pid, NULL, 0) <0){
        printf("waitpid error\n");
    }

    if((pid = fork()) < 0){
        printf("fork error.\n");
        exit(0);
    }else if(pid == 0){
        if(execlp("echoall", "echoall", "only 1 arg", NULL) < 0){
            printf("execlp error.\n");
            exit(0);
        }
    }
    exit(0);
}